Default Behavior
By default, the property grid control displays properties as follows:
- If the property is read-only, it is displayed as greyed-out text.
- If the property is a collection, it is displayed as an expandable item; when expanded, the collection items are shown as children. The grid displays buttons to add items to and remove items from the collection.
- If there is a built-in editor which can be used for the property, that editor is displayed.
- Otherwise, the property grid calls ToString() on the property value and displays that as greyed-out text, and displays the property as an expandable item. Expanding the item shows subproperties.
For example, a string or integer property is displayed in a text box where it can be edited. A PhoneNumber property is displayed as greyed out text by calling ToString() on the PhoneNumber object, but when the PhoneNumber is expanded its CountryCode, RegionCode and Number properties are displayed using editable text boxes.
To display complex types using your own text instead of ToString(), create a type editor with a read-only data template and set its AllowExpand property to true. See the Templating sample for an example of this, and see Customization and Styling and Templating for more information.